<?
require("config.php");

$location_status .= " | Add";

$show_backnav = "claim_menu";

require($rela_path . "bin/country.php");

$menutype = 2;

if (NULL!=$action){

   $field = array(
	"name",
	"addr",
	"addr_en",
	"msg",
	"rank",
	"pub"
	);


   $content = array(
	$name,
	$addr,
	$addr_en,
	$msg,
	$rate,
	$pub
	);

   myInsert($table,$field,$content);
   
	$Query = "select id from station order by id desc";

    $r = myQuery($Query);

    $cid=$r[0][0];
	
   $field = array(
	"region",
	"carrier",
	"regionc",
	"weightfrom",
	"weightto",
	"charge",
	"self",
	"cid"
	);


   $content = array(
	$addr,
	"Redemption Centre",
	$addr_en,
	"0",
	"0",
	"0",
	"1",
	$cid
	);

   myInsert("med_shipping",$field,$content);
	

    header("location:" . $rela_path . "share/msg.php?v=77&Start_Num=$Start_Num");

    exit();

}

//if (checkCode($table,$Code)){

//	header("location:" . $rela_path . "share/msg.php?v=9001");
//	exit();

//}

require($rela_path . "inc/header.php");

?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>


<form action="" method="post" name="form1">  

<!--hidden filed-->
<input name="action" type="hidden" value="add">
<input name="Code" type="hidden" value="<?print($Code)?>">





<br> 
<table width="95%" border="0" align="center">
  <tr> 
    <td align="right">
	
	<input type="image" src="../../images/bt_cancel.gif" width="78" height="23" onclick="Redirect('claim_menu.php?Start_Num=<?=$Start_Num?>&Search=<?=urlencode($Search)?>',1);return false;"> 
    <input name="image" type="image" onClick="MM_validateForm('Weightfrom','','RisNum','Weightto','','RisNum','Charge','','RisNum');return document.MM_returnValue" src="../../images/bt_save.gif" width="76" height="22">
</td>
  </tr>
</table>
<table width="95%" border="0" align="center">
  <tr>
    <td valign="top">&nbsp;</td>
  </tr>
  <tr> 
    <td valign="top"> <div align="right"> </div>
      <table border="0">
          <tr> 
          <td class="tdheader">Name :</td>
            <td>
			   <input name="name" type="text" id="name" class="text" size="50"> 
			</td>
          </tr>
          <tr> 
          <td class="tdheader">Address :</td>
            <td>
			   <input name="addr" type="text" id="addr" class="text" size="50"> 
			</td>
          </tr>
          <tr> 
          <td class="tdheader">Address(En) :</td>
            <td>
			   <input name="addr_en" type="text" id="addr_en" class="text" size="50"> 
			</td>
          </tr>
          <tr> 
          <td class="tdheader">Info :</td>
            <td>
			   <textarea name="msg" class="text"  cols="50" rows="12"></textarea>
			</td>
          </tr>
          <tr> 
          <td class="tdheader">Rate :</td>
            <td>
			   <input name="rate" type="text" id="rate" size="8" class="text"> %
			</td>
          </tr>
          <tr> 
          <td class="tdheader">Prublish? :</td>
            <td>
			   <input name="pub" type="radio" value="1" checked="checked">Y
			   <input name="pub" type="radio" value="0">N
			</td>
          </tr>
      </table>
	  </td>
  </tr>
</table>
<table width="95%" border="0" align="center">
  <tr> 
    <td align="right">
	
	
	<input type="image" src="../../images/bt_cancel.gif" width="78" height="23" onclick="Redirect('claim_menu.php?Start_Num=<?=$Start_Num?>&Search=<?=urlencode($Search)?>',1);return false;"> 
	<input type="image" onClick="MM_validateForm('Weightfrom','','RisNum','Weightto','','RisNum','Charge','','RisNum');return document.MM_returnValue" src="../../images/bt_save.gif" width="76" height="22"> 




    </td>
  </tr>
</table>
</form>
<br>
<br>
<br>
<?
require($rela_path . "inc/footer.php");
?>
